package com.meetingshow.privilege.service.util;

import java.util.Map;

import org.apache.commons.lang.StringUtils;

import com.meetingshow.common.base.dao.model.QueryStruct;
import com.meetingshow.common.base.service.BaseQueryParasBuilder;
import com.meetingshow.privilege.service.model.PriUserFollowQueryParas;

public class PriUserFollowQueryParasBuilder extends BaseQueryParasBuilder {
    public static QueryStruct priUserFollowQueryBuilder(
            QueryStruct queryStruct,
            PriUserFollowQueryParas priUserFollowQueryParas) throws Exception {
        builderInit(priUserFollowQueryParas, queryStruct);

        Map<String, Object> exactMap = queryStruct.getExactMap();

        if (StringUtils.isNotBlank(priUserFollowQueryParas.getId_e())) {
            exactMap.put(PriUserFollowServiceParas.PRI_USER_FOLLOW_PO_ID,
                    Integer.valueOf(priUserFollowQueryParas.getId_e()));
        }

        if (StringUtils.isNotBlank(priUserFollowQueryParas.getToUserId_e())) {
            exactMap.put(
                    PriUserFollowServiceParas.PRI_USER_FOLLOW_PO_TO_USER_ID,
                    Integer.valueOf(priUserFollowQueryParas.getToUserId_e()));
        }

        if (StringUtils.isNotBlank(priUserFollowQueryParas.getFromUserId_e())) {
            exactMap.put(
                    PriUserFollowServiceParas.PRI_USER_FOLLOW_PO_FROM_USER_ID,
                    Integer.valueOf(priUserFollowQueryParas.getFromUserId_e()));
        }

        pageBuilder(queryStruct, priUserFollowQueryParas);

        return queryStruct;
    }
}
